UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ed2Q/aPdGDBfGGN891nuM7NzlcsnO/Tl7A4SW3ORHaM=' 
WHERE 
  key_id = '537af126ddad6e097ffe9225c8a3e8d1d406d3585130b4064b76d0159390636d' 
  AND (
    token = 'Ed2Q/aPdGDBfGGN891nuM7NzlcsnO/Tl7A4SW3ORHaM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034