UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oTZH6m1PL9Jq3v3JjocBGq7l1eNDw66eTe5r7Cu56Cg=' 
WHERE 
  key_id = '5b70b223a621a56b56496b046d2886dc73090669adeaebe802576d792420a5bf' 
  AND (
    token = 'oTZH6m1PL9Jq3v3JjocBGq7l1eNDw66eTe5r7Cu56Cg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00083