UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OgQpkgR0iSibvKwmjoPXWoZAPLB/cCX2F4+fRTdaZMM=' 
WHERE 
  key_id = 'b3a7a354a469116f67490207baf7f28e5ef7f8b41219c83d509a64683328be67' 
  AND (
    token = 'OgQpkgR0iSibvKwmjoPXWoZAPLB/cCX2F4+fRTdaZMM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025