UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NC7E5/LbGLpaePlaO1s6IMiAXdHBxPgWgK+KfxP4NZQ=' 
WHERE 
  key_id = 'fafdc19471684609ec027cd0e7fc38a386765fd4f1383820df100174f29b25e9' 
  AND (
    token = 'NC7E5/LbGLpaePlaO1s6IMiAXdHBxPgWgK+KfxP4NZQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044