UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'miQJQsVm2Wsx6KIqwEkHh7s1DmW6lFaRK2uiMU3LQlQ=' 
WHERE 
  key_id = '017d446581b2752961ae7dae9ab0ba16dbdf9e2dc8ba6b1de9e5462247369ad2' 
  AND (
    token = 'miQJQsVm2Wsx6KIqwEkHh7s1DmW6lFaRK2uiMU3LQlQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031