UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tEYoIx0tVLZhvwaA+TRPO2Jgz1lj2hir7YTr3CMP6Vk=' 
WHERE 
  key_id = '6afe4e39b038b34f4758e1a00156a973ba74fc36f8a72bd359a67cbdd2c4790f' 
  AND (
    token = 'tEYoIx0tVLZhvwaA+TRPO2Jgz1lj2hir7YTr3CMP6Vk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037