UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b1dqZxLR7Kyja0kCv91DFfbEsNRoZPjSGZKR4h+W690=' 
WHERE 
  key_id = '2dcd64b31cb1c22ac13238cd71232ed36bd024dfd7bc96481f6ca817a4d4e36b' 
  AND (
    token = 'b1dqZxLR7Kyja0kCv91DFfbEsNRoZPjSGZKR4h+W690=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037