UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c5ca1o1G2i52Il4ZWdATV1/ekefVZDPHcvtOqMM+ymA=' 
WHERE 
  key_id = 'f98d0f12420b3c8fd1f689b6a2f671ed3f30332aed8d430bbfa7c087c467e5a9' 
  AND (
    token = 'c5ca1o1G2i52Il4ZWdATV1/ekefVZDPHcvtOqMM+ymA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032