UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZfmYo/Hc9IxBbt4pjJOHUAdktNa30RRGwV57adZvCnk=' 
WHERE 
  key_id = '645f5905c56eb96e34c1b8d4e5114295a112beaf9aa907d712c61cfe09b38050' 
  AND (
    token = 'ZfmYo/Hc9IxBbt4pjJOHUAdktNa30RRGwV57adZvCnk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024