UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EI5dznWxjLL7EsZQ0NPe9ymdE3P4Zh0+VV8QF6LIc+k=' 
WHERE 
  key_id = '2dc9e2c6fe634837d98abb212d4fec37bc4d77e6d5b718b6b46411271f7b3ae7' 
  AND (
    token = 'EI5dznWxjLL7EsZQ0NPe9ymdE3P4Zh0+VV8QF6LIc+k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024