UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BR218w5VH/9NysR0HQkX5DoTnTYmzPmtgEPi4Hz+uMs=' 
WHERE 
  key_id = 'a0f3703cb6ea4507a0e29542090b65848f31814b38210097b53f0dabb1bbab54' 
  AND (
    token = 'BR218w5VH/9NysR0HQkX5DoTnTYmzPmtgEPi4Hz+uMs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029