UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gHebrE64faTQtp0NF5+7JI3eH2yAVzDiTWMAcIdJdzo=' 
WHERE 
  key_id = 'cc5f32486fad1343134360a2746f84e562e5cc7074cb8b789a9d0497a1738898' 
  AND (
    token = 'gHebrE64faTQtp0NF5+7JI3eH2yAVzDiTWMAcIdJdzo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021