UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jlssKhRkCMhbSY+wNR6GnDiZTSRIiwTS/FAkYHo3Oow=' 
WHERE 
  key_id = 'b6baca4062949fdc52432889627995bb35c465d22c16a6dac4a504b5ccd33718' 
  AND (
    token = 'jlssKhRkCMhbSY+wNR6GnDiZTSRIiwTS/FAkYHo3Oow=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031