UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ug1vexB5TvSP+yGYQ3MZxZ046hGBI8YV+1SWrMxdHGU=' 
WHERE 
  key_id = '7efe95f7b6df6fe8f7489a099487896243acdf788941f2c4bb5c82545a25bfbb' 
  AND (
    token = 'ug1vexB5TvSP+yGYQ3MZxZ046hGBI8YV+1SWrMxdHGU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024