UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AwPjtcD/898YpFQwtEOloFWfkDUqa/WJS+7H4sHm1qI=' 
WHERE 
  key_id = '8668363c0b1df3807948c60fc1f3c3fc99b3383988332efed65bcfe07f447b22' 
  AND (
    token = 'AwPjtcD/898YpFQwtEOloFWfkDUqa/WJS+7H4sHm1qI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036