UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5h/wJA4jdnmcNeqUbUUnR2q/c/P8TXilHgNQlQLup0Q=' 
WHERE 
  key_id = '780c4b618f253190a7acfec34f67a3aacff3412477a15a9f57f154d2daf704ca' 
  AND (
    token = '5h/wJA4jdnmcNeqUbUUnR2q/c/P8TXilHgNQlQLup0Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040