UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BLDcTDfw5dOjidvSVUi2yiOoTj9W5S4CC1zMi2ji6EE=' 
WHERE 
  key_id = '3416aaa10399093a48201579e729ba480a2268cd904776cd2ed4fe9fd72c49df' 
  AND (
    token = 'BLDcTDfw5dOjidvSVUi2yiOoTj9W5S4CC1zMi2ji6EE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036