UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aq2voVszDoBGB5FpVhMSQ/FAko591RYN+/bcLPjYp1c=' 
WHERE 
  key_id = '369510c4e0bfaab3209abbeb95c5c773a88683743e53aad073677d850d27c076' 
  AND (
    token = 'aq2voVszDoBGB5FpVhMSQ/FAko591RYN+/bcLPjYp1c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061