UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dK/qOYeH5PIwvvT/puY8Iu2Sn426E0wPv4MAZ+7S/UY=' 
WHERE 
  key_id = '5d344d352b1b7e429c2b8035092b8ab066acd89fc1667773d9308b097d9d2afa' 
  AND (
    token = 'dK/qOYeH5PIwvvT/puY8Iu2Sn426E0wPv4MAZ+7S/UY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051