UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1ET9P2fajLbnGueJzrpT7R7+e/D9qP+TxcvenAs+LFw=' 
WHERE 
  key_id = '0cc06912f09bbec57e6fffd3b91b93c2dd1d72f5e269e242a13bda220fbf530f' 
  AND (
    token = '1ET9P2fajLbnGueJzrpT7R7+e/D9qP+TxcvenAs+LFw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022