UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Oa9XKJ2z69w1s+YWxvqC/4iDGUhhvvlqIlNEcZ6ux9I=' 
WHERE 
  key_id = 'a6e4e48eb1533199953a3488cb980c30e7d9ca0b6fe3c5b82f1411ecd07765e2' 
  AND (
    token = 'Oa9XKJ2z69w1s+YWxvqC/4iDGUhhvvlqIlNEcZ6ux9I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040