UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZqTWtwCOR3sZN4nVAO9BhAtvLqIr5wYbNuO9yew3REA=' 
WHERE 
  key_id = 'd3febf28b30169b309c08f200df94dbdfe500709511701c888b9dd60de1da3cb' 
  AND (
    token = 'ZqTWtwCOR3sZN4nVAO9BhAtvLqIr5wYbNuO9yew3REA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034