UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rCoCqTXxbgv4K3iBlIUMIm0rzAgrIyoMN9j+tFoFkQw=' 
WHERE 
  key_id = '776bfc8fdfec35b0456f88154c181af1cf51eb29adb795164d2c872838ef7aac' 
  AND (
    token = 'rCoCqTXxbgv4K3iBlIUMIm0rzAgrIyoMN9j+tFoFkQw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023