UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EXeHMtXWrUXB4GWR/+NNP3U3wNeKEF0NKNhyDGg/bco=' 
WHERE 
  key_id = 'c40a47c1018e5c4823c90c40a6ccb9c834c7f3a0042f81579b1567575f5c737d' 
  AND (
    token = 'EXeHMtXWrUXB4GWR/+NNP3U3wNeKEF0NKNhyDGg/bco=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042