UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tjSm/is9vtoj8O511tItFuIDAHVR9+2PETLIWV07gxs=' 
WHERE 
  key_id = 'f0edf9a6c30e28e4935b2d5245dc59277baac05eacb6c882a21cac0b7184562f' 
  AND (
    token = 'tjSm/is9vtoj8O511tItFuIDAHVR9+2PETLIWV07gxs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033