UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bOruzQHq1AgAWiFYPUFM/neHtWqB6mJfbofuD+/Y95o=' 
WHERE 
  key_id = '643c13141363b07ef697b75b57e7c1ce9146b4b1c4184c9f6323ecc001fa03c2' 
  AND (
    token = 'bOruzQHq1AgAWiFYPUFM/neHtWqB6mJfbofuD+/Y95o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00069