UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CJU/KAVOBXiASycRGbdcBr+t4f2glICZ+706pWmQ3M4=' 
WHERE 
  key_id = '639984d56016e67362fa71bc71c244ea4a7a7fd0826dd018b77b23970e9af8b2' 
  AND (
    token = 'CJU/KAVOBXiASycRGbdcBr+t4f2glICZ+706pWmQ3M4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035