UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TeGwZ9JaX3b4uEK8xz3eRFHZJtKBuYptDc40PVjivC0=' 
WHERE 
  key_id = '6e21c89dfd303dde3b73e15a189b12f2ef988dcaeab41edc8f91568eef0e7eae' 
  AND (
    token = 'TeGwZ9JaX3b4uEK8xz3eRFHZJtKBuYptDc40PVjivC0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028