UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'whrSZR27CEtQjfQWaPCFEAVzN688YRK50K+hqD6n3/Q=' 
WHERE 
  key_id = '22dc73ff265f0cfe80b4712c23f6a3c80b4f5e48e7d974c771e49ebe2c904d8b' 
  AND (
    token = 'whrSZR27CEtQjfQWaPCFEAVzN688YRK50K+hqD6n3/Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036