UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I1+2rd+472heaho9AydBvhV2jAeZUq6yKbs+FSSqbLE=' 
WHERE 
  key_id = '243d74cc66503e826a438ee9d1c646c329b2dacf2ad206d606cd99bd7cb4d762' 
  AND (
    token = 'I1+2rd+472heaho9AydBvhV2jAeZUq6yKbs+FSSqbLE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044