UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aa9CSkQnYSbHe/pwD+tm21Ne+op86KlSfoq1tAGPr94=' 
WHERE 
  key_id = '9c157fccb652810c4574ee69ee4c05f02f6181394fc44e0d78aa51e323498e26' 
  AND (
    token = 'aa9CSkQnYSbHe/pwD+tm21Ne+op86KlSfoq1tAGPr94=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033