UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZBN5qrrM/vAtk265VoatKpJXqK/p9Rk+StjXxYFCvqs=' 
WHERE 
  key_id = '1667c1af1b316e39256787dd949565f4786ca46c350a85e30631b8193b5145ce' 
  AND (
    token = 'ZBN5qrrM/vAtk265VoatKpJXqK/p9Rk+StjXxYFCvqs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030