UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DcYIWFUogzVGiPIBVXhxKsZLyUA04ZB0QZ8ij5ZBM90=' 
WHERE 
  key_id = '8e1c09323aaeb5c83f82bb1a3441605568d47ecb3d73347d7b2775733fff10b5' 
  AND (
    token = 'DcYIWFUogzVGiPIBVXhxKsZLyUA04ZB0QZ8ij5ZBM90=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048