UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dw1NVGDvJnmFNNROTaSy/9ec/wtw05QIifL5mIEEEUk=' 
WHERE 
  key_id = '83d9c948af4c4612a20e50296ebfa608f6ba8f41fcc8fe60140b79f126df2d61' 
  AND (
    token = 'Dw1NVGDvJnmFNNROTaSy/9ec/wtw05QIifL5mIEEEUk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026