UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VSDaw04LWWzXQfxX+SmoFseArWMLzdH1CHU1yBXr8io=' 
WHERE 
  key_id = '1f100484aa69c19f78e0866a5008e32f896b77915841a5047cdf6e2b008ba2a8' 
  AND (
    token = 'VSDaw04LWWzXQfxX+SmoFseArWMLzdH1CHU1yBXr8io=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00070