UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'owAIOEp9dIvS+7f4JAH83xtaTvr81ZlxYRUKofh1344=' 
WHERE 
  key_id = 'c3f0299208641aa475018ea511c39c92f592e26617e798308ad52892a85fbb0f' 
  AND (
    token = 'owAIOEp9dIvS+7f4JAH83xtaTvr81ZlxYRUKofh1344=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023